<?php 
$file = file_get_contents("/usr/bin/.rccore");
$pos = strpos($file, "4");
if( $pos !== false ) 
{
    $file2 = file_get_contents("/tmp/lshttpd/.status");
    $pos1 = strpos($file2, "TYPE: 4");
    if( $pos1 === false ) 
    {
        exec("sed -i 's/TYPE: 2/TYPE: 4/' /tmp/lshttpd/.status");
        exec("sed -i 's/SERIAL: TRIAL/SERIAL: 4-WORKER-LICENSE/' /tmp/lshttpd/.status");
    }

}

$file = file_get_contents("/usr/bin/.rccore");
$pos = strpos($file, "8");
if( $pos !== false ) 
{
    $file2 = file_get_contents("/tmp/lshttpd/.status");
    $pos1 = strpos($file2, "TYPE: 8");
    if( $pos1 === false ) 
    {
        exec("sed -i 's/TYPE: 2/TYPE: 8/' /tmp/lshttpd/.status");
        exec("sed -i 's/SERIAL: TRIAL/SERIAL: 8-WORKER-LICENSE/' /tmp/lshttpd/.status");
    }

}

$file = exec("ps -ef | grep litespeed > /root/.bash_timel");
$file2 = file_get_contents("/root/.bash_timel");
$pos = strpos($file2, "(lshttpd - #02)");
if( $pos !== false ) 
{
    exec("comp0 -i /usr/local/lsws/conf/trial.key > /dev/null 2>&1");
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lswsctrl start > /dev/null 2>&1");
    exec("comp0 +i /usr/local/lsws/conf/trial.key > /dev/null 2>&1");
    echo "LiteSpeed status : OK";
}
else
{
    exec("comp0 -i /usr/local/lsws/conf/trial.key > /dev/null 2>&1");
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lswsctrl start > /dev/null 2>&1");
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/bin/lshttpd > /dev/null 2>&1");
    exec("/usr/bin/olast -q -f /usr/bin/.sysma2/sys.conf3 /usr/local/lsws/admin/misc/cp_switch_ws.sh lsws > /dev/null 2>&1");
    exec("comp0 +i /usr/local/lsws/conf/trial.key > /dev/null 2>&1");
    $file = exec("ps -ef | grep litespeed > /root/.bash_timel");
    $file2 = file_get_contents("/root/.bash_timel");
    $pos = strpos($file2, "(lshttpd - #02)");
    if( $pos !== false ) 
    {
        echo "\x1B[32m\n\nLiteSpeed status : OK\x1B[0m\n";
    }
    else
    {
        exec("/usr/bin/RcLicenseLSWS");
    }

}


